import scrapy


class CarSpider(scrapy.Spider):
    name = "car"
    allowed_domains = ["www.autohome.com.cn"]
    start_urls = ["https://www.autohome.com.cn/price/ev"]

    def parse(self, response):
        name_list = response.xpath('//div[@class="tw-mt-1 tw-px-4"]/a[contains(@class, "tw-text-[#111E36]")]/text()')
        price_list = response.xpath('//p[@class="tw-pb-[10px]  tw-text-base tw-font-medium tw-leading-[1] tw-text-[#FF6600]"]/text()')


        for i in range(len(name_list)):
            name = name_list[i].extract()
            price = price_list[i].extract()
            print(name, price)